using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SharksHunter
{
    public partial class MainFormGen : Form, SharksHunter.Controller.Interfaces.ICollectionView
    {
        #region MEMBERS
        SharksHunter.Controller.Interfaces.ICollectionPresenter _presenter;
        #endregion

        #region WinGets
        private SharksHunter.TransferObjects.Presentation.IActionButton _saveCollectionBtn;
        private SharksHunter.TransferObjects.Presentation.IActionButton _newCollectionBtn;
        private SharksHunter.TransferObjects.Presentation.IActionButton _addEntityBtn;
        private SharksHunter.TransferObjects.Presentation.IActionButton _openCollectionBtn;
        private SharksHunter.TransferObjects.Presentation.IActionButton _huntCollectionBtn;
        #endregion

        public MainFormGen()
        {
            InitializeComponent();
            _presenter = new SharksHunter.Controller.Presenter.CollectionPresenter(this);
            CreateWinGets();
        }

        private void CreateWinGets()
        {
            _saveCollectionBtn = new SharksHunter.UI.Controls.MenuActionButton(this.saveToolStripMenuItem);
            _saveCollectionBtn.Click += delegate { _presenter.SaveCollection(); };

            _newCollectionBtn = new SharksHunter.UI.Controls.MenuActionButton(this.newToolStripMenuItem);
            _newCollectionBtn.Click += delegate { _presenter.NewCollection(); };

            _openCollectionBtn = new SharksHunter.UI.Controls.MenuActionButton(this.openToolStripMenuItem);
            _openCollectionBtn.Click += delegate { _presenter.OpenCollection(); };

            _openCollectionBtn = new SharksHunter.UI.Controls.MenuActionButton(this.huntToolStripMenuItem);
            _openCollectionBtn.Click += delegate { _presenter.Hunt(); };


            _addEntityBtn = new SharksHunter.UI.Controls.MenuActionButton(this.addEntityToolStripMenuItem);
            _addEntityBtn.Click += delegate { _presenter.AddEntity(); };

        }

        #region ICollectionView


        public object DataSource
        {
            set
            {
                this.bindingSource.DataSource = value;
            }
        }

        public void Log(SharksHunter.TransferObjects.Presentation.LogPriority pr, string text)
        {
            if (pr == SharksHunter.TransferObjects.Presentation.LogPriority.Critical)
            {
                MessageBox.Show(text);
            }
        }

        #region IActionButton
        public SharksHunter.TransferObjects.Presentation.IActionButton NewActionButton
        {
            get
            {
                return this.NewActionButton;
            }
        }
        //IActionButton OpenActionButton { get;}
        #endregion

        #region Params
        public SharksHunter.TransferObjects.Presentation.IParamProvider QueryNewCollectionParam()
        {
            return new SharksHunter.UI.Controls.Params.NewCollectionParamProvider(new Windows.NewCollection());
        }

        public SharksHunter.TransferObjects.Presentation.IParamProvider QueryOpenCollectionFile()
        {
            return new SharksHunter.UI.Controls.Params.OpenCollectionFileProvider();
        }

        public SharksHunter.TransferObjects.Presentation.IParamProvider QueryNewEntityFile()
        {
            return new SharksHunter.UI.Controls.Params.NewEntityFileProvider();
        }


        #endregion

        #endregion

    }
}